跳到主要内容

PasteSpecial

Pastes the Range object to the specified range using the special paste options.

Syntax

expression.PasteSpecial(sPasteType, sPasteSpecialOperation, bSkipBlanks, bTranspose);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sPasteTypeOptionalPasteType"xlPasteAll"Paste option.
sPasteSpecialOperationOptionalPasteSpecialOperation"xlPasteSpecialOperationNone"The mathematical operation which will be applied to the copied data.
bSkipBlanksRequiredboolean[bSkipBlanks=false] - Specifies whether to avoid replacing values in the paste area when blank cells occur in the copy area.
bTransposeRequiredboolean[bTranspose=false] - Specifies whether the pasted data will be transposed from rows to columns.

Returns

This method doesn't return any data.

Example

This example pastes data from clipboard(if it possible) with options.

var oWorksheet = Api.GetActiveSheet();
var oRange = oWorksheet.GetRange("A1");
oRange.SetValue("test");
oWorksheet.GetRange("A1").Copy();
oWorksheet.GetRange("B1").PasteSpecial("xlPasteAll", "xlPasteSpecialOperationNone", false, false);